package com.lizemin.builderfactorycase.factory.simple;

import com.lizemin.builderfactorycase.factory.entity.FileParser;
import org.junit.jupiter.api.Test;

/**
 * @author lzm
 * @date 2025/10/19 15:28
 * @description
 */
public class Main {

    @Test
    public void test_use_simple_factory() {
        // 获取pdf文件解析器
        FileParser pdfFileParser = ParserFactory.getParser("pdf");
        System.out.println(pdfFileParser.parse(null));

        // 获取doc文件解析器
        FileParser docFileParser = ParserFactory.getParser("doc");
        System.out.println(docFileParser.parse(null));
    }

    @Test
    public void test_use_simple_factory_v2() {
        // 获取pdf文件解析器
        FileParser pdfFileParser = ParserFactoryV2.getParser("pdf");
        System.out.println(pdfFileParser.parse(null));

        // 获取doc文件解析器
        FileParser docFileParser = ParserFactoryV2.getParser("doc");
        System.out.println(docFileParser.parse(null));
    }

}
